home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / clocks / attall / atomic.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-04-16  |  21.0 KB  |  613 lines

  1. VERSION 2.00
  2. Begin Form Atomic 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Call the Atomic Clock"
  6.    ClientHeight    =   4665
  7.    ClientLeft      =   2160
  8.    ClientTop       =   1995
  9.    ClientWidth     =   4695
  10.    ClipControls    =   0   'False
  11.    Height          =   5100
  12.    Left            =   2085
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   4665
  17.    ScaleWidth      =   4695
  18.    Top             =   1635
  19.    Width           =   4845
  20.    Begin TextBox InitString 
  21.       BackColor       =   &H00FFFFFF&
  22.       Height          =   300
  23.       Left            =   390
  24.       TabIndex        =   6
  25.       Text            =   "ATZ"
  26.       Top             =   1710
  27.       Width           =   4080
  28.    End
  29.    Begin MSComm Comm1 
  30.       InBufferSize    =   2048
  31.       Interval        =   1000
  32.       Left            =   3390
  33.       NullDiscard     =   -1  'True
  34.       OutBufferSize   =   2048
  35.       RTSEnable       =   -1  'True
  36.       Top             =   1125
  37.    End
  38.    Begin SSCheck DST 
  39.       Caption         =   "Use Daylight Savings Time"
  40.       ForeColor       =   &H00000000&
  41.       Height          =   285
  42.       Left            =   225
  43.       TabIndex        =   4
  44.       Top             =   960
  45.       Width           =   2640
  46.    End
  47.    Begin ComboBox TimeZone 
  48.       BackColor       =   &H00FFFFFF&
  49.       Height          =   300
  50.       Left            =   375
  51.       Style           =   2  'Dropdown List
  52.       TabIndex        =   3
  53.       Top             =   450
  54.       Width           =   4065
  55.    End
  56.    Begin CommandButton Command1 
  57.       Cancel          =   -1  'True
  58.       Caption         =   "Cancel"
  59.       Height          =   345
  60.       Index           =   2
  61.       Left            =   2370
  62.       TabIndex        =   1
  63.       Top             =   4020
  64.       Width           =   2085
  65.    End
  66.    Begin CommandButton Command1 
  67.       Caption         =   "Dial"
  68.       Default         =   -1  'True
  69.       Height          =   345
  70.       Index           =   1
  71.       Left            =   2370
  72.       TabIndex        =   0
  73.       Top             =   3510
  74.       Width           =   2070
  75.    End
  76.    Begin CommandButton Command1 
  77.       Caption         =   "Reset Defaults"
  78.       Height          =   345
  79.       Index           =   0
  80.       Left            =   2370
  81.       TabIndex        =   14
  82.       Top             =   3000
  83.       Width           =   2070
  84.    End
  85.    Begin SSFrame Frame3D1 
  86.       Caption         =   "COM Port"
  87.       ForeColor       =   &H00000000&
  88.       Height          =   1530
  89.       Left            =   255
  90.       TabIndex        =   9
  91.       Top             =   2910
  92.       Width           =   1965
  93.       Begin SSOption ComPort 
  94.          Caption         =   "COM&4:"
  95.          ForeColor       =   &H00000000&
  96.          Height          =   240
  97.          Index           =   3
  98.          Left            =   135
  99.          TabIndex        =   13
  100.          Top             =   1185
  101.          Width           =   780
  102.       End
  103.       Begin SSOption ComPort 
  104.          Caption         =   "COM&3:"
  105.          ForeColor       =   &H00000000&
  106.          Height          =   240
  107.          Index           =   2
  108.          Left            =   135
  109.          TabIndex        =   12
  110.          Top             =   885
  111.          Width           =   780
  112.       End
  113.       Begin SSOption ComPort 
  114.          Caption         =   "COM&2:"
  115.          ForeColor       =   &H00000000&
  116.          Height          =   240
  117.          Index           =   1
  118.          Left            =   135
  119.          TabIndex        =   11
  120.          Top             =   585
  121.          Width           =   780
  122.       End
  123.       Begin SSOption ComPort 
  124.          Caption         =   "COM&1:"
  125.          ForeColor       =   &H00000000&
  126.          Height          =   240
  127.          Index           =   0
  128.          Left            =   135
  129.          TabIndex        =   10
  130.          Top             =   285
  131.          Width           =   780
  132.       End
  133.    End
  134.    Begin TextBox DialString 
  135.       BackColor       =   &H00FFFFFF&
  136.       Height          =   300
  137.       Left            =   375
  138.       TabIndex        =   8
  139.       Text            =   "ATDT 1 303 494-4774"
  140.       Top             =   2430
  141.       Width           =   4080
  142.    End
  143.    Begin Label Label1 
  144.       BackStyle       =   0  'Transparent
  145.       Caption         =   "Modem Initialization String"
  146.       Height          =   210
  147.       Index           =   2
  148.       Left            =   240
  149.       TabIndex        =   5
  150.       Top             =   1440
  151.       Width           =   2415
  152.    End
  153.    Begin Label Status 
  154.       Alignment       =   1  'Right Justify
  155.       BackStyle       =   0  'Transparent
  156.       Height          =   240
  157.       Left            =   1125
  158.       TabIndex        =   15
  159.       Top             =   15
  160.       Width           =   3300
  161.    End
  162.    Begin Label Label1 
  163.       BackStyle       =   0  'Transparent
  164.       Caption         =   "Modem Dial String"
  165.       Height          =   210
  166.       Index           =   1
  167.       Left            =   225
  168.       TabIndex        =   7
  169.       Top             =   2160
  170.       Width           =   2145
  171.    End
  172.    Begin Label Label1 
  173.       BackStyle       =   0  'Transparent
  174.       Caption         =   "Time Zone"
  175.       Height          =   240
  176.       Index           =   0
  177.       Left            =   195
  178.       TabIndex        =   2
  179.       Top             =   165
  180.       Width           =   1320
  181.    End
  182. Option Explicit
  183. Dim ControlsDisabled As Integer
  184. Dim Instring As String
  185. Dim TString As String
  186. Dim Aborted As Integer
  187.                              'DESCRIPTION OF THE
  188.                  'AUTOMATED COMPUTER TELEPHONE SERVICE (ACTS)
  189. 'The following is transmitted (at 1200 Baud) after completion of the
  190. 'telephone connection.
  191.              '? = HELP
  192.              'National Institute of Standards and Technology
  193.              'Telephone Time Service
  194.                                      'D  L D
  195.               'MJD  YR MO DA H  M  S  ST S UT1 msADV        <OTM>
  196.              '47999 90-04-18 21:39:15 50 0 +.1 045.0 UTC(NIST) *
  197.              '47999 90-04-18 21:39:16 50 0 +.1 045.0 UTC(NIST) *
  198.              '47999 90-04-18 21:39:17 50 0 +.1 045.0 UTC(NIST) *
  199.              '47999 90-04-18 21:39:18 50 0 +.1 045.0 UTC(NIST) *
  200.              '47999 90-04-18 21:39:19 50 0 +.1 037.6 UTC(NIST) #
  201.              '47999 90-04-18 21:39:20 50 0 +.1 037.6 UTC(NIST) #
  202.              'etc..etc...etc.......
  203. 'UTC = Universal Time Coordinated, the official world time referred to the
  204. 'zero meridian.
  205. '_________________________________________________________________________
  206. 'DST = Daylight savings time characters, valid for the continental U.S., are
  207. 'set as follows:
  208.   '00 = We are on standard time (ST).    50 = We are on DST.
  209.   '99 to 51 = Now on ST, go to DST when your local time is 2:00 am and the
  210.     'count is 51.  The count is decremented daily at 00 (UTC).
  211.   '49 to 01 = Now on DST, go to ST when your local time is 2:00 am and the
  212.     'count is 01.  The count is decremented daily at 00 (UTC).
  213. 'The two DST characters provide up to 48 days advance notice of a change in
  214. 'time.  The count remains at 00 or 50 at other times.
  215. '_________________________________________________________________________
  216. 'LS = Leap second flag is set to "1" to indicate that a leap second is to be
  217. 'added as 23:59:60 (UTC) on the last day of the current UTC month.  The LS
  218. 'flag will be reset to "0" starting with 23:59:60 (UTC).  The flag will
  219. 'remain on for the entire month before the second is added.  Leap seconds
  220. 'are added as needed at the end of any month.  Usually June and/or December
  221. 'are chosen.
  222. '__________________________________________________________________________
  223. 'DUT1 = Approximate difference between earth rotation time (UT1) and UTC, in
  224. 'steps of 0.1 second.         DUT1 = UT1 - UTC
  225. '___________________________________________________________________________
  226. 'MJD = Modified Julian Date, often used to tag certain scientific data.
  227. '___________________________________________________________________________
  228. 'The full time format is sent at 1200 Baud, 8 bit, 1 stop, no parity.
  229. 'The format at 300 Baud is also 8 bit, 1 stop, no parity.
  230. 'At 300 Baud the MJD and DUT1 values are deleted and the
  231. 'time is transmitted only on even seconds.
  232. '___________________________________________________________________________
  233. 'Maximum on line time will be 56 seconds.  If all lines are busy at any time,
  234. 'the oldest call will be terminated if it has been on line more than 28
  235. 'seconds, else, the call that first reaches 28 seconds will be terminated.
  236. '___________________________________________________________________________
  237. 'Current time is valid at the "on-time" marker (OTM), either "*" or "#".
  238. 'The nominal on-time marker (*) will be transmitted 45 ms early to account
  239. 'for the 8 ms required to send 1 character at 1200 Baud, plus an additional
  240. '7 ms for delay from NIST to the user, and approximately 30 ms "scrambler"
  241. 'delay inherent in 1200 Baud modems.  If the caller echoes all characters,
  242. 'NIST will measure the round trip delay and advance the on-time marker so
  243. 'that the midpoint of the stop bit arrives at the user on time.  The amount
  244. 'of msADV will reflect the actual required advance in milliseconds and the
  245. 'OTM will be a "#".  The NIST system requires 4 or 5 consecutive delay
  246. 'measurements which are consistent before switching from "*" to "#".
  247. 'If the user has a 1200 Baud modem with the same internal delay as that used
  248. 'by NIST, then the "#" OTM should arrive at the user within +-2 ms of the
  249. 'correct time.  However, NIST has studied different brands of 1200 Baud
  250. 'modems and found internal delays from 24 ms to 40 ms and offsets of the
  251. '"#" OTM of +-10 ms.  For many computer users, +-10 ms accuracy should be
  252. 'more than adequate since many computer internal clocks can only be set with
  253. 'granularity of 20 to 50 ms.  In any case, the repeatability of the offset
  254. 'for the "#" OTM should be within +-2 ms, if the dial-up path is reciprocal
  255. 'and the user doesn't change the brand or model of modem used. This should
  256. 'be true even if the dial-up path on one day is a land-line of less than
  257. '40 ms (one way) and on the next day is a satellite link of 260 to 300 ms.
  258. 'In the rare event that the path is one way by satellite and the other way
  259. 'by land line with a round trip measurement in the range of 90 to 260 ms,
  260. 'the OTM will remain a "*" indicating 45 ms advance.
  261. '___________________________________________________________________________
  262. 'For user comments write:
  263. 'NIST-ACTS
  264. 'Time and Frequency Division
  265. 'Mail Stop 524
  266. '325 Broadway
  267. 'Boulder, CO  80303
  268. 'Software for setting (PC)DOS compatable machines is available
  269. 'on a 360-kbyte diskette for $35.00 from:
  270. 'NIST Office of Standard Reference Materials
  271. 'B311-Chemistry Bldg, NIST, Gaithersburg, MD, 20899, (301) 975-6776
  272. '--------------------------------------------------------------------------
  273. Sub Command1_Click (Index As Integer)
  274. Dim StartTime As Double
  275. Dim I As Integer
  276. Dim NewD As Double
  277. Dim OldD As Double
  278. Dim DSTFlag As String
  279. Dim OffBy As String
  280. Dim Cmd$, CommLen%
  281. Dim T$
  282. Dim CPos%
  283. Dim Hrs%, Mns%
  284. If Index = 0 Then  'Reset Defaults
  285.    ResetDefaults
  286.    Status.Caption = ""
  287. End If
  288. If Index = 1 Then  'Dial
  289.    SaveModemSettings
  290.    Aborted = False
  291.    Status.Caption = ""
  292.    Command1(0).Enabled = False
  293.    Command1(1).Enabled = False
  294.    TimeZone.Enabled = False
  295.    DST.Enabled = False
  296.    DialString.Enabled = False
  297.    InitString.Enabled = False
  298.    Frame3D1.Enabled = False
  299.    ControlsDisabled = True
  300.    On Local Error GoTo ErrHndl
  301.    For I% = 0 To 3
  302.      If ComPort(I%).Value Then Comm1.CommPort = I% + 1
  303.    Next I%
  304.    If Aborted Then Exit Sub
  305.    Comm1.Settings = "1200,N,8,1"
  306.    If Aborted Then Exit Sub
  307.    Comm1.PortOpen = True
  308.    If Aborted Then Exit Sub
  309. 'Debug.Print comm1.InBufferCount
  310.    Cmd$ = InitString.Text + Chr$(13) + Chr(10)
  311.    CommLen% = Len(Cmd$)
  312.    Comm1.Output = Cmd$
  313. 'Debug.Print comm1.InBufferCount
  314.    StartTime = Timer
  315.    LastTime = 0
  316.    Do
  317.       DoEvents
  318.       If LastTime <> Int(Timer) Then
  319.          If Not Aborted Then Status.Caption = "Initial - " + Format$(10 - Int(Timer - StartTime)) + " seconds until timeout."
  320.          LastTime = Int(Timer)
  321.       End If
  322.    Loop Until Comm1.InBufferCount > CommLen% + 5 Or ((Timer - StartTime) > 10) Or Aborted
  323.    If Aborted Then Exit Sub
  324.    Instring$ = Comm1.Input
  325.    If Instring$ = "" Then
  326.       Status.Caption = ""
  327.       MsgBox "No response from modem."
  328.       EnableControls
  329.       Exit Sub
  330.    End If
  331.    'Debug.Print ">"; instring$; "<"
  332.    DoEvents
  333.    While Comm1.InBufferCount > 0
  334.    DoEvents
  335.    DoEvents
  336.    DoEvents
  337.    DoEvents
  338.    DoEvents
  339.    DoEvents
  340.    Instring$ = Comm1.Input
  341.    'Debug.Print ">"; instring$; "<"
  342.    Wend
  343.    StartTime = Timer
  344.    LastTime = 0
  345. While (Timer - StartTime) < 3
  346. DoEvents
  347.       If LastTime <> Int(Timer) Then
  348.          If Not Aborted Then Status.Caption = "Waiting - " + Format$(3 - Int(Timer - StartTime)) + " seconds."
  349.          LastTime = Int(Timer)
  350.       End If
  351.    If Aborted Then Exit Sub
  352.    Instring$ = Comm1.Input
  353.    'Debug.Print ">"; instring$; "<"
  354.    Comm1.Output = DialString.Text + Chr$(13) + Chr(10)
  355.    StartTime = Timer
  356.    LastTime = 0
  357.    Do
  358.       DoEvents
  359.       If LastTime <> Int(Timer) Then
  360.          If Not Aborted Then
  361.              T$ = "Connecting - "
  362.              If Comm1.InBufferCount > 50 Then T$ = "Connected - "
  363.              Status.Caption = T$ + Format$(75 - Int(Timer - StartTime)) + " seconds until timeout."
  364.          End If
  365.          LastTime = Int(Timer)
  366.       End If
  367.    Loop Until (Comm1.InBufferCount >= 500) Or ((Timer - StartTime) > 75) Or Aborted
  368.    If Aborted Then Exit Sub
  369.    If (Timer - StartTime) > 75 Then
  370.          Status.Caption = "Timed out."
  371.          Exit Sub
  372.    End If
  373.    Status.Caption = "Setting time."
  374.    DoEvents
  375.    If Aborted Then Exit Sub
  376.    Instring$ = Comm1.Input
  377.    Instring$ = Right$(Instring$, 120)
  378.    Instring$ = Mid$(Instring$, InStr(Instring$, "*") + 1, 80)
  379.    NewD = DateValue(DateSerial(Val(Mid$(Instring$, 9, 2)), Val(Mid$(Instring$, 12, 2)), Val(Mid$(Instring$, 15, 2))))
  380.    NewD = NewD + TimeValue(Mid$(Instring$, 18, 8)) + .75 * TimeValue("0:00:01")  'fudge!!
  381.    'here!!!!!!
  382.    T$ = TimeZone.Text
  383.    CPos% = InStr(T$, ")")
  384.    T$ = Trim$(Mid$(T$, CPos% + 1, 255))
  385.    CPos% = InStr(T$, ":")
  386.    Hrs% = Val(Mid$(T$, 1, CPos% - 1))
  387.    Mns% = Val(Mid$(T$, CPos% + 1, 255))
  388.    NewD = NewD + TimeSerial(Hrs%, Sgn(Hrs%) * Mns%, 0)
  389.    'NewD = NewD - (TimeZone.ListIndex - 11) * (1 / 24)
  390.    DSTFlag$ = Mid$(Instring$, 27, 2)
  391.    'If ((DSTFlag >= "01") And (DSTFlag <= "50")) Then
  392.    '   NewD = NewD - (1 / 24)
  393.    'End If
  394.    If DST.Value Then
  395.       NewD = NewD + (1 / 24)
  396.    End If
  397.    OldD = Date + Time
  398.    If Year(NewD) >= 1993 Then
  399.       Date = Format$(NewD, "Short Date")
  400.       Time = Format$(NewD, "Long Time")
  401.       If OldD > NewD Then
  402.          OffBy = "fast"
  403.       Else
  404.          OffBy = "slow"
  405.       End If
  406.       MsgBox "Time set to " + Format$(NewD, "Long Time") + ".  Clock was " + OffBy$ + " by " + Format$(Abs(NewD - OldD), "hh:mm:ss") + "."
  407.       Screen.MousePointer = 11
  408.       AtomicTimeWasSet = True
  409.       Status.Caption = "Time set."
  410.    Else
  411.       MsgBox "Error getting date and time."
  412.    End If
  413.    If Aborted Then Exit Sub
  414.    Screen.MousePointer = 11
  415.    HangUp
  416.    Screen.MousePointer = 0
  417.    If Aborted Then Exit Sub
  418.    On Local Error Resume Next
  419.    Unload Atomic
  420. End If
  421. If Index = 2 Then  'Cancel
  422.    If ControlsDisabled Then
  423.       Screen.MousePointer = 11
  424.       Status.Caption = "Cancelling."
  425.       HangUp
  426.       EnableControls
  427.       Aborted = True
  428.       Status.Caption = "Aborted."
  429.       Screen.MousePointer = 0
  430.    Else
  431.       Unload Atomic
  432.    End If
  433. End If
  434. EnableControls
  435. Exit Sub
  436. ErrHndl:
  437. If Instring$ <> "" Then
  438.    MsgBox "Error: " + Error(Err) + Chr$(13) + Chr$(10) + "Contents of buffer: " + Instring$
  439.    MsgBox "Error: " + Error(Err)
  440. End If
  441. If Comm1.PortOpen Then Comm1.PortOpen = False
  442. Aborted = True
  443. EnableControls
  444. Resume Next
  445. Exit Sub
  446. End Sub
  447. Sub DialString_GotFocus ()
  448. DialString.SelStart = 0
  449. DialString.SelLength = 32767
  450. End Sub
  451. Sub EnableControls ()
  452.    Command1(0).Enabled = True
  453.    Command1(1).Enabled = True
  454.    TimeZone.Enabled = True
  455.    DST.Enabled = True
  456.    DialString.Enabled = True
  457.    InitString.Enabled = True
  458.    Frame3D1.Enabled = True
  459.    ControlsDisabled = False
  460.    If Comm1.PortOpen Then Comm1.PortOpen = False
  461. End Sub
  462. Sub Form_Load ()
  463. Dim I%
  464. Atomic.Left = Settings.Left + (Settings.Width / 2) - (Atomic.Width / 2)
  465. Atomic.Top = Settings.Top + (Settings.Height / 2) - (Atomic.Height / 2)
  466. For I% = 1 To TZs%
  467.    TimeZone.AddItem TZ$(I%)
  468. Next I%
  469. 'TimeZone.AddItem "Greenwich + 11"
  470. 'TimeZone.AddItem "Greenwich + 10"
  471. 'TimeZone.AddItem "Greenwich + 9"
  472. 'TimeZone.AddItem "Greenwich + 8"
  473. 'TimeZone.AddItem "Greenwich + 7"
  474. 'TimeZone.AddItem "Greenwich + 6"
  475. 'TimeZone.AddItem "Greenwich + 5"
  476. 'TimeZone.AddItem "Greenwich + 4"
  477. 'TimeZone.AddItem "Greenwich + 3"
  478. 'TimeZone.AddItem "Greenwich + 2"
  479. 'TimeZone.AddItem "Greenwich + 1"
  480. 'TimeZone.AddItem "Greenwich"
  481. 'TimeZone.AddItem "Greenwich - 1"
  482. 'TimeZone.AddItem "Greenwich - 2"
  483. 'TimeZone.AddItem "Greenwich - 3"
  484. 'TimeZone.AddItem "Atlantic Standard Time (4)"
  485. 'TimeZone.AddItem "Eastern Standard Time"
  486. 'TimeZone.AddItem "Central Time"
  487. 'TimeZone.AddItem "Mountain Time"
  488. 'TimeZone.AddItem "Pacific Time"
  489. 'TimeZone.AddItem "Yukon Standard Time"
  490. 'TimeZone.AddItem "Alaska-Hawaii Standard Time"
  491. 'TimeZone.AddItem "Nome Standard Time"
  492. 'TimeZone.AddItem "Greenwich - 12"
  493. ResetDefaults
  494. LoadModemSettings
  495. 'Atomic.Show 1
  496. 'Command1(1).SetFocus
  497. End Sub
  498. Sub HangUp ()
  499.    Dim StartTime As Double
  500.    Dim I As Integer
  501.    Dim Ret As Integer
  502.    'Josh version  -
  503.    'comm1.PortOpen = False
  504.    'Exit Sub
  505.    'Beep
  506.    On Local Error GoTo ErrHndl2
  507.    'comm1.Output = "+++"
  508.    'StartTime = Timer
  509.    'While Timer - StartTime < .5
  510.    '  DoEvents
  511.    'Wend
  512.    'comm1.Output = "ATH0" + Chr$(13) + Chr(10)
  513.    Comm1.Output = ""
  514.    For I% = 1 To 3
  515.    StartTime = Timer
  516.    TString$ = Comm1.Input
  517.    Comm1.Output = "+"
  518.    While Timer - StartTime < .25
  519.      DoEvents
  520.    Wend
  521.    Next I%
  522.    'Do
  523.    '   DoEvents
  524.    'Loop Until comm1.InBufferCount >= 2
  525.    StartTime = Timer
  526.    While Timer - StartTime < 3#
  527.      DoEvents
  528.    Wend
  529.    TString$ = Comm1.Input
  530.    Comm1.Output = "ATH0" + Chr(13) + Chr(10)
  531.    StartTime = Timer
  532.    Do
  533.       DoEvents
  534.    Loop Until Comm1.InBufferCount >= 2 Or (Timer - StartTime) > 5
  535.    TString$ = Comm1.Input
  536.    StartTime = Timer
  537.    While Timer - StartTime < 1#
  538.      DoEvents
  539.    Wend
  540.    '3/28/92 version
  541.    Comm1.PortOpen = False
  542.    Exit Sub
  543.    Comm1.Output = "+++"
  544.    StartTime = Timer
  545.    While Timer - StartTime < .5
  546.      DoEvents
  547.    Wend
  548.    Comm1.Output = "ATH0" + Chr$(13) + Chr(10)
  549.    Ret = Comm1.DTREnable     'Save current setting
  550.    Comm1.DTREnable = True    'Turn DTR on
  551.      DoEvents
  552.    Comm1.DTREnable = False   'Turn DTR off
  553.      DoEvents
  554.    Comm1.DTREnable = Ret     'Restore old setting
  555.    Comm1.PortOpen = False
  556. ErrHndl2:
  557.   EnableControls
  558.   Exit Sub
  559. End Sub
  560. Sub InitString_GotFocus ()
  561. InitString.SelStart = 0
  562. InitString.SelLength = 32767
  563. End Sub
  564. Sub LoadModemSettings ()
  565. Dim lpReturnedString As String * 100
  566. Dim a As Integer
  567. Dim I%
  568. lpReturnedString = Space$(100)
  569. 'a% = MyGetProfileString("AllTheTime", "TimeZoneIndex", "16", lpReturnedString$, 100)
  570. a = 0
  571. For I% = 1 To TZs%
  572.    If InStr(TZ$(I%), "(" + gTimeZone + ")") Then a = I% - 1
  573. Next I%
  574. TimeZone.ListIndex = a
  575. 'a% = MyGetProfileString("AllTheTime", "DST", "0", lpReturnedString$, 100)
  576. DST.Value = Val(gDST)
  577. a% = MyGetProfileString("AllTheTime", "DialString", "ATDT 1 303 494-4774", lpReturnedString$, 100)
  578. DialString.Text = Trim$(lpReturnedString)
  579. a% = MyGetProfileString("AllTheTime", "ModemInitString", "ATZ", lpReturnedString$, 100)
  580. InitString.Text = Trim$(lpReturnedString)
  581. a% = MyGetProfileString("AllTheTime", "ComPort", "0", lpReturnedString$, 100)
  582. ComPort(Val(lpReturnedString)).Value = True
  583. End Sub
  584. Sub ResetDefaults ()
  585. Dim a%
  586. Dim I%
  587. a = 0
  588. For I% = 1 To TZs%
  589.    If InStr(TZ$(I%), "(" + gTimeZone + ")") Then a = I% - 1
  590. Next I%
  591. TimeZone.ListIndex = a
  592.    'TimeZone.ListIndex = 16
  593.    DST.Value = Val(gDST)
  594.    DialString.Text = "ATDT 1 303 494-4774"
  595.    InitString.Text = "ATZ"
  596.    ComPort(0).Value = True
  597.    'LoadModemSettings
  598. End Sub
  599. Sub SaveModemSettings ()
  600. Dim a As Integer
  601. Dim M As String
  602. Dim I As Integer
  603. 'a% = WritePrivateProfileString("AllTheTime", "TimeZoneIndex", TimeZone.ListIndex, "ATT.INI")
  604. 'a% = WritePrivateProfileString("AllTheTime", "DST", DST.Value, "ATT.INI")
  605. a% = WritePrivateProfileString("AllTheTime", "DialString", DialString.Text, "ATT.INI")
  606. a% = WritePrivateProfileString("AllTheTime", "ModemInitString", InitString.Text, "ATT.INI")
  607. M$ = "0"
  608. For I% = 0 To 3
  609.    If ComPort(I%).Value Then M$ = Str$(I%)
  610. Next I%
  611. a% = WritePrivateProfileString("AllTheTime", "ComPort", M$, "ATT.INI")
  612. End Sub
  613.